import {request} from "umi";

export async function listGoodsByPage(body: RequestParam<API.GoodsDTO>, options?: { [key: string]: any }){
  return request<BaseResponse<IPage<API.WarehouseVO>>>('/api/goods/list',{
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
  })
}

export async function addGoods(body: RequestParam<API.GoodsDTO>){
  return request<BaseResponse<IPage<API.WarehouseVO>>>('/api/goods/add',{
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
  })
}

export async function updateGoods(body: API.GoodsDTO){
  return request<BaseResponse<boolean>>('/api/goods/update',{
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
  })
}

export async function deleteGoods(id: string){
  return request<BaseResponse<boolean>>('/api/goods/delete',{
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: {id: id}
  });
}
